package cn.yanji;

import cn.yanji.service.DriverService;
import cn.yanji.service.ExecuteService;
import org.openqa.selenium.WebDriver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import java.io.FileNotFoundException;

/**
 * Hello world!
 */
@Configuration
@ComponentScan(basePackages = "cn.yanji.service.impl")
public class App {

	private static final Logger logger = LoggerFactory.getLogger(App.class);

	public static void main(String[] args) throws FileNotFoundException {
		AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(App.class);

		ExecuteService executeService = applicationContext.getBean(ExecuteService.class);
		executeService.exec();
	}

	@Bean
	public WebDriver webDriver(DriverService driverService) throws FileNotFoundException {
		return driverService.chromeBuilder().argument("--disable-gpu").devtools().wechat().windows();
	}

}
